
<#include "../common/head.ftl" />
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>权限添加</title>
    <@comme_head />
	<@comme_table />
    <link rel="stylesheet" href="/css/user-add.css"/>
    <script>
    	function getPrent(level){
    		$.ajax({
			   type: "GET",
			   url: "/manager/getParent",
			   data: "level="+level,
			   success: function(msg){
			   		if(msg.length>0){
				   		var msgJson = eval(msg);
				   		$("#partPower").empty();
				   		for(var i=0;i<msgJson.length;i++){
				   			$("#partPower").append("<option value='"+msgJson[i].id+"'>"+msgJson[i].name+"</option>");
				   		}
			   		}
			   }
			});
    	
    	}
    
    
    	function levelChange(level){
    		switch (level) {
				case 1:
					$("#partPower").empty();
					break;
				case 2:
					getPrent(1);
					break;
				case 3:
					getPrent(2);
					break;
			}
    	}
    </script>
</head>
<body>
<@comme_header />
<div class="main clearfix" id="main">
    <@comme_daohang />
    <div class="right-content">
        <div class="content">
            <div id="container">
                <form class="biaodan" action="/manager/power_save" method="post">
                	<input type="hidden" name="id"  class="tiaozheng" value="${id!}"/>
                    权限名称：<input type="text" name="name"  class="tiaozheng" value="${name!}"/><br/>
                    权限地址：<input type="text" name="poweraddr" value="${poweraddr!}" class="tiaozheng"/><br/>
                    等级：	<lable><input type="radio" onChange = "levelChange(1)" name="level" value="1" <#if '${level!}' == '1'>checked</#if> class="tiaozheng2"/>一级</lable>
                    <lable><input type="radio" onChange = "levelChange(2)" name="level" value="2" <#if '${level!}' == '2'>checked</#if> class="tiaozheng2"/>二级</lable>
                    <lable><input type="radio" onChange = "levelChange(3)" name="level" value="3" <#if '${level!}' == '3'>checked</#if> class="tiaozheng2"/>三级</lable>
                    <br/>
	                    父权限：<select id="partPower"  name="parentId"> 
                        <#if parents?? && ((parents?size)>0)>
	                    	<#list  parents as data >
	                    		<li>
	                    			<option value='${data.id!}' <#if '${parent_id!}' == '${data.id!}'>selected</#if>>${data.name!}</option>
	                    		</li>
	                		</#list> 
                		</#if>
	                  </select><br/>
                    备注：	<textarea name="remarks" >${remarks!}</textarea>
                    <input type="submit" value="保存" style="display: block;width:100px;height:30px;margin-left:510px;margin-top:50px;"/>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>